<?php
/**
 *
 * Empty (空模块)
 */

class EmptyAction extends Action {

    public function _empty() {

        $a = ACTION_NAME?ACTION_NAME:"index";
        //空操作 空模块
        if(MODULE_NAME!='Urlrule'){
            $Mod = F('Mod');

            if(!$Mod[MODULE_NAME]){
                header("HTTP/1.0 404 Not Found");				
                //header("Location:".C("ERROR_PAGE"));
                //404 2020.07.09
                header("Location:/Public/404.html");				
                exit;
                $this->display();
            }
        }

        $id = intval(I('id'));
        $catid = intval(I('catid'));
        $moduleid = intval(I('moduleid'));
        	
        if(MODULE_NAME=='Urlrule'){
            if(APP_LANG){
                $lang = I('l') ? '_'.I('l') : '_'.C('DEFAULT_LANG');
            }
            if($_GET['catdir']){
                $Cat = F('Cat'.$lang);

                $catid = $catid ? $catid : $Cat[$_REQUEST['catdir']];
                unset($Cat);
            }

            if (!empty($_GET['module'])) {
                $m = I('module');
            } elseif($moduleid) {
                $Module = F('Module');
                $m = $Module[$moduleid]['module'];
                unset($Module);
            } elseif(!empty($catid)) {
                $Category = F('Category'.$lang);
                $m = $Category[$catid]['module'];
                unset($Category);
            }else{
                header("HTTP/1.0 404 Not Found");				header("Location:".C("ERROR_PAGE"));				exit;
                $this->display();
            }
            if($a=='index') $id=$catid;
        }else{
            if(empty($id)){
                $Cat = F('Cat'.$lang);
                $id = $Cat[$_REQUEST['id']];
                unset($Cat);
            }
            $m = MODULE_NAME;
        }

        import('@.Action.Public');
        $myclass = $m.'Action';
        if(class_exists($myclass)){
            $bae = new $myclass();

            if(!method_exists($bae,$a)){
                header("HTTP/1.0 404 Not Found");				header("Location:".C("ERROR_PAGE"));				exit;
                $this->display();
            }
            $_GET['id'] = $id;
            $bae->$a($id,$m);
        }else{

            $bae = new ContentAction();

            $bae->$a($id,$m);
        }
    }

}